﻿using System;

namespace SharpGym.Model
{
    public partial class Aluno
    {
        public double Idade
        {
            get
            {
                var aniversario = new DateTime(DataNascimento);
                var now = DateTime.Today;
                var age = now.Year - aniversario.Year;
                if (aniversario > now.AddYears(-age)) age--;

                return age;
            }
        }
    }
}